<HTML>

<HEAD>

<script language=vbscript>

Randomize

function Dec2Hex(Decimal) 
	hexChars = "0123456789ABCDEF"
	a = Decimal mod 16
	b = (Decimal - a)/16
	hexaa = "" & mid(hexChars,b+1,1) & mid(hexChars,a+1,1)
	L = mid(hexChars,a+1,1)
	H = mid(hexChars,b+1,1)
	Dec2Hex = hexaa
end function

function randByte()
	randByte=int(Rnd()*256)
end function

function doita() 
	s1 = formx.inp.value
	xvaluestart = randByte()
	xrefkill =  "0x" & Dec2Hex(randByte()) & Dec2Hex(randByte()) & Dec2Hex(randByte()) & Dec2Hex(randByte())
	'xvaluestart = 1
	'xrefkill =  "0x22334455"

	finallen = len(s1)+1
	hexsequence = chr(34)
	xvalue = xvaluestart
	for i = 0 to len(s1)-1
		ch     = mid(s1,i+1,1)
		if ch= "\" then
		    i=i+1
		    finallen=finallen-1
		    ch     = mid(s1,i+1,1)
		    if ch="0" then
		    	chval = 0
		    elseif ch="n" then
		    	chval = 10
		    elseif ch="\" then
		    	chval = asc("\")
		    elseif ch="r" then
		    	chval = 13
		    elseif ch=chr(34) then
		    	chval = 34
		    else
		    	alert("invalid control sequence: " & asc(ch) & " " & ch)
		    end if
		'elseif ch="|" then
		'	chval=0
		else 
			'alert(ch)
		    	chval  = asc(ch)
		    	'alert(chval)
			'if chval=0 then
		    	'formx.ans.value = "invalid character: " & ch
		    	'Exit Function
			'end if
		end if
		if chval>0 then
			chval = chval Xor xvalue
			xvalue = xvalue + 1
			xvalue = xvalue mod 256
			hexsequence = hexsequence & "\x"& Dec2Hex(chval)
		elseif chval<0 then
			finallen=finallen+1
			chval=chval+65536
			a=chval mod 256
			b=(chval-a)/256
			
			b = b Xor xvalue
			xvalue = xvalue + 1
			xvalue = xvalue mod 256
			hexsequence = hexsequence & "\x"& Dec2Hex(b)
			
			a = a Xor xvalue
			xvalue = xvalue + 1
			xvalue = xvalue mod 256
			hexsequence = hexsequence & "\x"& Dec2Hex(a)
		end if
	next
	hexsequence = hexsequence & chr(34)
	s2  = "/*" & s1 & "*/XorStr<0x" & Dec2Hex(xvaluestart) & ","  & finallen & "," & xrefkill & ">("
	s2 = s2 & hexsequence & "+" & xrefkill & ").s"
	
	formx.ans.value = s2
	formx.ans.focus()
	formx.ans.select()

end function


</script>

</HEAD>


<CENTER>
<FORM name="formx">
<INPUT name="inp" size="100" value="Insert String">  <br><br>	
<INPUT onclick="doita()" type="button" value="******  CONVERT TO XOR STRING   ******"><br>&nbsp;&nbsp;<BR>
<INPUT name="ans" size="160"> 
</FORM>
</CENTER>
